import com.beans.User;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.core.io.ClassPathResource;

public class APP {
    public static void main(String[] args) {
        ApplicationContext context =
                new ClassPathXmlApplicationContext("spring-config.xml");
//        User user = (User)context.getBean("user");
        User user = context.getBean("user",User.class);
//        User user = context.getBean(User.class);

        user.sayHi("张三");
//        BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource("spring-config.xml"));
//        User user = (User)beanFactory.getBean("user");
//        user.sayHi("李四");

    }
}
